package model

import (
	"k8s-platform/db"
	"time"
)

type WorKflow struct {
	ID        uint `gorm:"primary_key" json:"id"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
	
	Name string `json:"name" gorm:"unique;not null"`
	Namespace string `json:"namespace"`
	Replicas int32 `json:"replicas"`
	Deployment string `json:"deployment"`
	Service string `json:"service"`
	Ingress string `json:"ingress"`
	Type string `json:"type" gorm:"column:type"`  //nodeport  clusterip  ingress
}

//TableName方法返回mysql表名
func (w *WorKflow)TableName() string {
	return "workflow"
}

func MakeMigrate()  {
	db.GORM.AutoMigrate(&WorKflow{})
}
/*
CREATE TABLE `workflow` (
	`id` int unsigned AUTO_INCREMENT,
	`created_at` DATETIME NULL,
	`updated_at` DATETIME NULL,
	`deleted_at` DATETIME NULL,
	`name` varchar(255),
	`namespace` varchar(255),
	`replicas` int,
	`deployment` varchar(255),
	`service` varchar(255),
	`ingress` varchar(255),
	`type` varchar(255) ,
	PRIMARY KEY (`id`)
)

*/


